Yes. In fact, this is what is done with input redirection.
With file input redirection, a disk file is connected to the
standard input stream used by a Scanner object.
You can also construct a scanner object that connects to
a disk file:
File file = new File("myData.txt"); // create a File object
Scanner scan = new Scanner( file ); // connect a Scanner to the file
These statements first create a File object.
This is a software object that represents a disk file.
Next a Scanner object is constructed and connected
to the actual file.
The same methods can be used with this Scanner object
as with standard input.
Characters than can be converted into an int can be scanned in
using nextInt() as with the standard input stream.
Must the disk file that is used with Scanner be a text file?